<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>CreatePopupMenu</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">CreatePopupMenu()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>CreatePopupMenu</b></font>(#Menu)  </blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Creates a new empty popup menu. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Menu</i></td>
<td width="90%"> 
A number to identify the new menu. <a href="../reference/purebasic_objects.html">#PB_Any</a> 可以用来自动生成这个编码. 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Nonzero if the menu was successfully created, zero otherwise. If <font color="#924B72">#PB_Any</font> was used 
for the #Menu parameter then the generated number is returned on success. 

 

</blockquote><p><b>备注</b></p><blockquote>



To create a popup menu with support for images, use <a href="createpopupimagemenu.html">CreatePopupImageMenu()</a>. 
<br>
<br>
Once created, this menu becomes the current menu for further item additions. It's now 
possible to use functions such as <a href="menutitle.html">MenuTitle()</a>, <a href="menuitem.html">MenuItem()</a>, <a href="menubar.html">MenuBar()</a>, <a href="opensubmenu.html">OpenSubMenu()</a> to populate the menu. 
<br>
<br>
<a href="displaypopupmenu.html">DisplayPopupMenu()</a> can be used to display this popup menu at any position on the screen. 
<br>
<br>
To handle menu events properly, see the description of following functions: 
<br>
<a href="../window/waitwindowevent.html">WaitWindowEvent()</a> (alternatively <a href="../window/windowevent.html">WindowEvent()</a>) 
<br>
<a href="../window/eventwindow.html">EventWindow()</a> 
<br>
<a href="../window/eventmenu.html">EventMenu()</a> 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 200, 200, 200, 120, "Popup-Menu Example")
  
    <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreatePopupMenu</font>(0)      <font color="#3A3966">; creation of the pop-up menu begins...</font>
<font color="#3A3966">      MenuItem</font>(1, "Open")      <font color="#3A3966">; You can use all commands for creating a menu</font>
<font color="#3A3966">      MenuItem</font>(2, "Save")      <font color="#3A3966">; just like in a normal menu...</font>
<font color="#3A3966">      MenuItem</font>(3, "Save as")
<font color="#3A3966">      MenuItem</font>(4, "Quit")
<font color="#3A3966">      MenuBar</font>()
<font color="#3A3966">      OpenSubMenu</font>("Recent files")
<font color="#3A3966">        MenuItem</font>(5, "PureBasic.exe")
<font color="#3A3966">        MenuItem</font>(6, "Test.txt")
<font color="#3A3966">      CloseSubMenu</font>()
    <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()     <font color="#3A3966">; check for window events</font>
      
      <b><font color="#3A3966">Select</font></b> Event
        <b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event_RightClick</font>       <font color="#3A3966">; right mouse button was clicked =&gt;</font>
<font color="#3A3966">          DisplayPopupMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))  <font color="#3A3966">; now display the popup-menu</font>
          
        <b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event_Menu</font>        <font color="#3A3966">; an item of the popup-menu was clicked</font>
          <b><font color="#3A3966">Select</font></b> <font color="#3A3966">EventMenu</font>()       <font color="#3A3966">; get the clicked menu item...</font>
            <b><font color="#3A3966">Case</font></b> 1 : <b><font color="#3A3966">Debug</font></b> "Menu: Open"
            <b><font color="#3A3966">Case</font></b> 2 : <b><font color="#3A3966">Debug</font></b> "Menu: Save"
            <b><font color="#3A3966">Case</font></b> 3 : <b><font color="#3A3966">Debug</font></b> "Menu: Save as"
            <b><font color="#3A3966">Case</font></b> 4 : <b><font color="#3A3966">End</font></b>
            <b><font color="#3A3966">Case</font></b> 5 : <b><font color="#3A3966">Debug</font></b> "Menu: PureBasic.exe"
            <b><font color="#3A3966">Case</font></b> 6 : <b><font color="#3A3966">Debug</font></b> "Menu: Text.txt"
          <b><font color="#3A3966">EndSelect</font></b>
          
      <b><font color="#3A3966">EndSelect</font></b>
      
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>
<p><img src="../HelpPictures/createpopupmenu.png"></p>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="createpopupimagemenu.html">CreatePopupImageMenu()</a>, <a href="displaypopupmenu.html">DisplayPopupMenu()</a>, 
<a href="createmenu.html">CreateMenu()</a>, <a href="createimagemenu.html">CreateImageMenu()</a>, <a href="freemenu.html">FreeMenu()</a>, <a href="menutitle.html">MenuTitle()</a>, <a href="menuitem.html">MenuItem()</a>, <a href="menubar.html">MenuBar()</a>, <a href="opensubmenu.html">OpenSubMenu()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=createpopupimagemenu.html>CreatePopupImageMenu()</a> - <a href="index.html">Menu Index</a> - <a href="disablemenuitem.html">DisableMenuItem()</a> -&gt;<br><br>

</body></html>